<?php
/**
 * Classe REPOSITORY da tabela TB_PARAM_CLASSE
 * 
 * @author			Mário R. Castro
 * @copyright		Voitech Sistema
 * @package			SEMAS
 * @subpackage		semas.application.models
 * @version			1.0
*/
class App_Model_ParamClasseRepository{

    public function listarTodos(array $arrParametro) {
        $arrDbParamClasse = App_Model_Db_ParamClasse::build()->listarTodos(new Voitech_TO($arrParametro));
        $arrParamClasse = array();
        foreach($arrDbParamClasse as $row) {
            $obParamClasseMapper = new App_Model_ParamClasseMapper(new App_Model_ParamClasse());
            $arrParamClasse[] = $obParamClasseMapper->carregar($row)->getObModel();
        }
        return $arrParamClasse;
    }
	
    
    public function salvar(App_Model_ParamClasse $obParamClasse) {
        $obParamClasseMapper = new App_Model_ParamClasseMapper($obParamClasse);
        if( $obParamClasse->getCoParamClasse() < 1 )
        {
            return $obParamClasseMapper->cadastrar();
        }
        return $obParamClasseMapper->alterar();
        
    }
    
    public function ativar(App_Model_ParamClasse $oParamClasse) {
        $obParamClasseMapper = new App_Model_ParamClasseMapper($oParamClasse); 
        return $obParamClasseMapper->ativar();
    }
    
    public function desativar(App_Model_ParamClasse $oParamClasse) {
        $obParamClasseMapper = new App_Model_ParamClasseMapper($oParamClasse); 
        return $obParamClasseMapper->desativar();
    }
    
    public function excluir(App_Model_ParamClasse $oParamClasse) {
        $obParamClasseMapper = new App_Model_ParamClasseMapper($oParamClasse); 
        return $obParamClasseMapper->excluir();
    }

    
}